#include <iostream>
#include <vector>

enum class Color
{
    balck,
    white
};

struct PiecePos
{
    int x;
    int y;
};

class Piece //抽象棋子类
{
public:
    virtual void draw() = 0;
private:
    Color c;
};

class BlackPiece:public Piece
{
public:
    void draw()
    {
        std::cout<<"下一颗黑棋"<<std::endl;
    }
};

class WhitePiece:public Piece
{
public:
    void draw()
    {
        std::cout<<"下一颗白棋"<<std::endl;
    }
};

class pieceBoard
{
public:
    pieceBoard(const std::string& white, const std::string& black)
    {
        this->blackName = black;
        this->whiteName = white;
        this->black = nullptr;
        this->white = nullptr;
    }

    void SetPiece(Color c, int x, int y)
    {
        if(c == Color::white)
        {
            if(this->white == nullptr)
            {
                this->white = new WhitePiece;
            }
            std::cout<<whiteName<<"在("<<x<<","<<y<<")";
            this->white->draw();
            whitevec.push_back({x,y});
        }
        else
        {
            if(this->black == nullptr)
            {
                this->black = new BlackPiece;
            }
            std::cout<<blackName<<"在("<<x<<","<<y<<")";
            this->black->draw();
            blackvec.push_back({x,y});
        }
    }
private:
    Piece *black;//黑子
    Piece *white;//白子
    std::vector<PiecePos> blackvec;
    std::vector<PiecePos> whitevec;
    std::string blackName;
    std::string whiteName;
};

int main()
{
    pieceBoard board("A", "B");
    board.SetPiece(Color::white, 0, 0);
    board.SetPiece(Color::balck, 1, 0);
    board.SetPiece(Color::white, 3, 0);
    board.SetPiece(Color::white, 4, 0);
    board.SetPiece(Color::balck, 5, 0);

}